﻿using System;
using System.Xml;
using System.Xml.XPath;

namespace AmazonBookLinker
{
  internal static class VersionDetector
  {
    internal static Version GetCurrentVersion( string programName )
    {
      var document = new XmlDocument();
      document.Load( XmlReader.Create( @"http://www.briandicroce.com/versions.xml" ) );
      var navigator = document.CreateNavigator();
      return new Version( navigator.Select( string.Format( @"programs/program[@name=""{0}""]", programName ) ).Current.Value );
    }
  }
}